import numpy as np

# Sample propsoal pairs with a pyramid around specific level (a list) if given
def mulity_scale_pairs(proposals, ids=None, scale=2):
    '''
    :return: [ [ len(ids) x 4 ] ... ]
    '''
    pairs = []
    num = proposals.shape[0]

    if ids is not None: plist = ids
    else: plist = list(range(num))

    for i in plist:
        # 原有特征放在 维度0
        # 左右特征扩大一点放在 维度1
        top = np.zeros((2, 4))
        top[0, :] = proposals[i, :]

        center = (proposals[i, 0] + proposals[i, 1]) / 2
        length = (proposals[i, 1] - proposals[i, 0]) / 2
        top[1, 0] = center - length*scale
        top[1, 1] = center + length*scale
        pairs.append(top)

    return pairs
